﻿using System;
using System.Web.UI.WebControls;
using Core.Library;
using DataObject;
using DataObject.Product;

namespace KMT.Controls.Product
{
    public partial class RelatedProduct : System.Web.UI.UserControl
    {
        public int CategoryId { get; set; }
        public int ProductId { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                ListRelatedProduct();
        }

        private void ListRelatedProduct()
        {
            var lstProduct = ProductController.Product_ListPaginationRelatedProduct(SettingValues.PageSize_12, CategoryId, ProductId);
            if (lstProduct != null && lstProduct.Rows.Count > 0)
            {
                rptRelatedProduct.DataSource = lstProduct;
                rptRelatedProduct.DataBind();
            }
        }

        protected void rptProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            Utility.RptProduct_NewProduct_SaleProduct(sender, e);
        }        
    }
}